home *** CD-ROM | disk | FTP | other *** search
/ Merciful 1 / Merciful - Disc 1.iso / software / a / asm_one / asm-onev1.25b.dms / in.adf / Release3.1 / Docs3.1.lha / Docs3.0 / ILBM.Readme < prev    next >
Encoding:
Text File  |  1992-09-15  |  9.4 KB  |  274 lines

  1.  
  2. V39 Support Issues related to Display Modes and ILBM's
  3. ======================================================
  4.  
  5. Copyright (c) 1985-1992 Commodore-Amiga, Inc.  All Rights Reserved
  6. Preliminary, Confidential, and Subject to Change
  7.  
  8.  
  9. For compatibility with and support of enhanced Amiga graphics
  10. capabilities, both short-term, and long-term possibilities, you must
  11. modify your software to remove any built-in limitations which would
  12. prevent you from growing WITH the Amiga.
  13.  
  14.  
  15. 1. Get RID of Hardcoded Limits, Write Software that Adapts
  16.  
  17. Many of the Amiga graphics software packages currently on the market
  18. are hardcoded like the old "DF0: DH0:" file requesters.
  19.  
  20. Such hardcoded graphics application software limits include:
  21.  
  22.     - offering a fixed set of display modes or sizes
  23.     - offering a fixed range of depths or sizes for certain display modes
  24.     - loading or handling a maximum of 32 colors
  25.     - Dealing with color guns as 4-bit values
  26.  
  27.  
  28. The first thing you need to think about when upgrading your application
  29. for V39, is NOT to upgrade it for V39.  You must upgrade your software
  30. so that it can adapt to arbitrary display modes, depths, and sizes.
  31.  
  32. If you offer different display modes, do not arbitrarily restrict
  33. the modes that you offer.  If 8-bitplane hires, or hires HAM, are
  34. supported by a new chip set, and your software restricts a user to
  35. 5-bitplane hires and lores HAM, then your software will be obsolete.
  36.  
  37. Rewrite your software to use features such as the 2.1 display mode
  38. requester.  Make sure that can adapt to larger palettes.  Handle
  39. R G and B values internally as 8-bits, not 4.
  40.  
  41.  
  42.  
  43. 2. Proper IFF ILBM Support
  44.  
  45.     A. Proper ILBM.CAMG Chunk
  46.        ======================
  47.     1. Saving
  48.     
  49.     If running under V36 or higher, save ULONG GetVPModeID(viewport)
  50.     as-is.
  51.  
  52.     ISSUE: If you save a mode like VGA, and an old loader that
  53.     just uses the low word of the CAMG loads it, it will display
  54.     as non-interlace picture (because the VGA ModeID does not have
  55.     the "lace" bit set in its 32-bit modeid number).  Because of this,
  56.     you may wish to give your user the option of saving pictures with
  57.     CAMG modes other than their native display id. 
  58.  
  59.     
  60.     2. Loading
  61.  
  62.     Support using full 32-bit modeid's from CAMG (with screening
  63.     for bad ID's and fallback code if ModeNotAvailable(modeid).
  64.     Screening required because there are some CAMG's out there with
  65.     garbage in the upper word.  See sample "getcamg" code at end.
  66.  
  67.  
  68.     B. Proper ILBM.BMHD X and Y aspect
  69.        ===============================
  70.     1. Saving
  71.  
  72.     See "getaspect" code below.  This code gets the correct
  73.     aspect ratio for any viewport modeid from the display
  74.     database.  If running under < V36, it falls back to
  75.     updated 2.0-compatible aspect values for old modes.
  76.  
  77.     2. Loading
  78.  
  79.     Perhaps you can start to expect reasonable information
  80.     in the ILBM.BMHD x and y aspect fields.
  81.  
  82.  
  83.     C. Proper 8-bit-per-gun ILBM.CMAP
  84.        ==============================
  85.  
  86.     1. Saving
  87.  
  88.     Either always save as eight bits per gun, or offer an
  89.     8-bit palette option.  When saving 8-per-gun from
  90.     4-bit-per-gun source, do NOT left justify the 4 bits
  91.     in R, G, and B bytes, but rather SCALE each 4-bit value to
  92.     8 bits by duplicating the 4-bit value in the upper and lower
  93.     nibble of its R, G, or B CMAP byte.
  94.  
  95.  
  96.     2. Loading
  97.  
  98.     Detect and use full color resolution 8-bit-per-gun CMAPs
  99.     when on a V39 or higher machine.  One (only?) method
  100.     of detection may be to check if EVERY CMAP byte has 0 as
  101.     its low nibble.  It may be better to use an 8-bit palette
  102.     use option to flag whether all 8 bits of of each gun should
  103.     be considered significant.
  104.  
  105.     ISSUES: Looking for all-zero low nibbles is not really a good
  106.     way to determine 4-bit shifted CMAPs.  We might define a bit of
  107.     the BMHD Reserved1 (pad1) field to signify that 8 significant
  108.     bits-per-gun have been saved.  In addition, the OS engineers
  109.     are working on a DisplayInfo chunk (DINF) which would provide
  110.     this and other enhanced display mode information.
  111.  
  112.  
  113.     D.  Stop Limiting Color Register Load Counts to 32
  114.         ==============================================
  115.  
  116.     Older IFF code, and even the earlier NewIFF code would
  117.     read any number of colors from an ILBM CMAP, but would
  118.     only set a maximum 32 colors in the display.  
  119.     Instead, the maximum number of colors set in the display
  120.     should be limited by the display Viewport's ColorMap->Count
  121.     rather than a hardcoded limit.
  122.  
  123.  
  124.     E.  Stop Limiting Depth to 5/6
  125.         ==========================
  126.  
  127.     Older IFF code had fixed limits for the maximum allowable
  128.     depth for displays and ILBMs.  Remove your limits.
  129.     Display as much as the system can handle.  Don't reject
  130.     depths and depth/mode combinations arbitrarily.
  131.     Also, you may want to stop assuming that a 6-plane ILBM
  132.     with no CAMG is HAM or HALFBRITE (although that might still
  133.     be a good assumption since only a pretty lame program would
  134.     write a HAM or HALFBRITE ILBM with no CAMG chunk).
  135.  
  136.     
  137.     F.     Watch out for interleaved bitmaps
  138.            =================================
  139.     
  140.     If your application supports capturing any screen, you
  141.     must watch out for the new interleaved bitmaps.
  142.     An interleaved BitMap's BytesPerRow field is still the
  143.     modulo for getting from any one pixel to the pixel directly
  144.     below it, BUT it is no longer related to the rounded up
  145.     width of the screen or viewport.  Instead, it is a MUCH
  146.     larger value which is actually the rounded up BitMap scan
  147.     line width TIMES the depth.  Do not assume that BytesPerRow
  148.     is related to the width of the display.
  149.  
  150.     NOTE: The 2.0 Native Developer Update release of the NewIFF
  151.     code had 2 major bugs.  The screen.c module had a 1.3
  152.     incompatibility, and the ilbmr.c module could not properly
  153.     save an interleaved bitmap (such as the V39 Workbench screen).
  154.     See the newer version 37.9 of the NewIFF code.  This has
  155.     been placed in our listinsg area on BIX, and sent to ADSP, and
  156.     sent to Fred Fish.  Note that this release of the NewIFF code
  157.     (37.9) does not yet contain any direct V39 or locale support.
  158.     However, it was written with these in mind.
  159.  
  160.     Under V39, an interleaved bitmap can be detected by:
  161.  
  162.     if(GetBitMapAttr(bitmap_ptr,BMA_FLAGS) & BMF_INTERLEAVED)
  163.         printf("is interleaved\n");
  164.  
  165.  
  166.     G. Proper Printing of new Display Modes
  167.        ====================================
  168.  
  169.     When dumping a rastport to printer under V36 and higher,
  170.     the following IORequest field must contain a 32-bit modeid
  171.     such as that returned by GetVPModeID(viewport).  You
  172.     may want to allow the user the ability to print a display
  173.     with a different modeid than it is being displayed in.
  174.     Passing the full modeid allows the printer.device to
  175.     properly control the aspect of the output.
  176.  
  177.        ULONG   io_Modes;               /* graphics viewport modes */
  178.  
  179.  
  180.  
  181. -------------------------- getcamg -------------------------------
  182. From: /* ilbmr.c --- ILBM loading routines for use with iffparse */
  183.  
  184. /*
  185.  * Returns CAMG or computed mode for storage in ilbm->camg
  186.  *
  187.  * ilbm->Bmhd structure must be initialized prior to this call.
  188.  */
  189. ULONG getcamg(struct ILBMInfo *ilbm)
  190.     {
  191.     struct IFFHandle *iff;
  192.     struct StoredProperty *sp;
  193.     UWORD  wide,high,deep;
  194.     ULONG modeid = 0L;
  195.  
  196.         if(!(iff=ilbm->ParseInfo.iff))    return(0L);
  197.  
  198.     wide = ilbm->Bmhd.pageWidth;
  199.     high = ilbm->Bmhd.pageHeight;
  200.     deep = ilbm->Bmhd.nPlanes;
  201.  
  202.     D(bug("Getting CAMG for w=%ld h=%ld d=%ld ILBM\n",wide,high,deep));
  203.  
  204.         /*
  205.          * Grab CAMG's idea of the viewmodes.
  206.          */
  207.         if (sp = FindProp (iff, ID_ILBM, ID_CAMG))
  208.                 {
  209.                 modeid = (* (ULONG *) sp->sp_Data);
  210.  
  211.                 /* knock bad bits out of old-style 16-bit viewmode CAMGs
  212.                  */
  213.                 if((!(modeid & MONITOR_ID_MASK))||
  214.           ((modeid & EXTENDED_MODE)&&(!(modeid & 0xFFFF0000))))
  215.                    modeid &= 
  216.             (~(EXTENDED_MODE|SPRITES|GENLOCK_AUDIO|GENLOCK_VIDEO|VP_HIDE));
  217.  
  218.                 /* check for bogus CAMG like DPaintII brushes
  219.                  * with junk in upper word and extended bit
  220.                  * not set in lower word.
  221.                  */
  222.                 if((modeid & 0xFFFF0000)&&(!(modeid & 0x00001000))) sp=NULL;
  223.                 }
  224.  
  225.         if(!sp) {
  226.                 /*
  227.                  * No CAMG (or bad CAMG) present; use computed modes.
  228.                  */
  229.                 if (wide >= 640)        modeid = HIRES;
  230.                 if (high >= 400)        modeid |= LACE;
  231.  
  232.         /* This 6 planes == HAM or HALFBRITE is not
  233.          * necessarily true anymore, but hopefully
  234.          * all NEW programs are writing a proper CAMG chunk!!
  235.          */
  236.                 if (deep == 6)
  237.                         {
  238.                         modeid |= ilbm->EHB ? EXTRA_HALFBRITE : HAM;
  239.                         }
  240.  
  241.         D(bug("No CAMG found - using mode $%08lx\n",modeid));
  242.                 }
  243.  
  244.     D(bug("getcamg: modeid = $%08lx\n",modeid));
  245.     return(modeid);
  246.     }
  247.  
  248.  
  249. -------------------------- getaspect -------------------------------
  250.  
  251.     bmhd->xAspect = 0;  /* So we can tell when we've got it */
  252.     if(GfxBase->lib_Version >=36)
  253.         {
  254.         if(GetDisplayInfoData(NULL, (UBYTE *)&DI,
  255.                 sizeof(struct DisplayInfo), DTAG_DISP, modeid))
  256.                 {
  257.                 bmhd->xAspect =  DI.Resolution.x;
  258.                 bmhd->yAspect =  DI.Resolution.y;
  259.                 }
  260.         }
  261.  
  262.     /* If running under 1.3 or GetDisplayInfoData failed, use old method
  263.      * of guessing aspect ratio
  264.      */
  265.     if(! bmhd->xAspect)
  266.         {
  267.         bmhd->xAspect =  44;
  268.         bmhd->yAspect =
  269.                 ((struct GfxBase *)GfxBase)->DisplayFlags & PAL ? 44 : 52;
  270.         if(modeid & HIRES)      bmhd->xAspect = bmhd->xAspect >> 1;
  271.         if(modeid & LACE)       bmhd->yAspect = bmhd->yAspect >> 1;
  272.         }
  273.  
  274.